Optimal. Leaf size=225 \[ -\frac {a^4 (92 A-93 i B) \tan ^3(c+d x)}{60 d}-\frac {(12 A-13 i B) \tan ^3(c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{20 d}+\frac {4 a^4 (B+i A) \tan ^2(c+d x)}{d}+\frac {8 a^4 (A-i B) \tan (c+d x)}{d}+\frac {8 a^4 (B+i A) \log (\cos (c+d x))}{d}-8 a^4 x (A-i B)-\frac {(2 A-3 i B) \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{10 d}+\frac {i a B \tan ^3(c+d x) (a+i a \tan (c+d x))^3}{6 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.64, antiderivative size = 225, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.147, Rules used = {3594, 3592, 3528, 3525, 3475} \[ -\frac {a^4 (92 A-93 i B) \tan ^3(c+d x)}{60 d}+\frac {4 a^4 (B+i A) \tan ^2(c+d x)}{d}-\frac {(2 A-3 i B) \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{10 d}-\frac {(12 A-13 i B) \tan ^3(c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{20 d}+\frac {8 a^4 (A-i B) \tan (c+d x)}{d}+\frac {8 a^4 (B+i A) \log (\cos (c+d x))}{d}-8 a^4 x (A-i B)+\frac {i a B \tan ^3(c+d x) (a+i a \tan (c+d x))^3}{6 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3525
Rule 3528
Rule 3592
Rule 3594
Rubi steps
\begin {align*} \int \tan ^2(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx &=\frac {i a B \tan ^3(c+d x) (a+i a \tan (c+d x))^3}{6 d}+\frac {1}{6} \int \tan ^2(c+d x) (a+i a \tan (c+d x))^3 (3 a (2 A-i B)+3 a (2 i A+3 B) \tan (c+d x)) \, dx\\ &=\frac {i a B \tan ^3(c+d x) (a+i a \tan (c+d x))^3}{6 d}-\frac {(2 A-3 i B) \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{10 d}+\frac {1}{30} \int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 \left (6 a^2 (8 A-7 i B)+6 a^2 (12 i A+13 B) \tan (c+d x)\right ) \, dx\\ &=\frac {i a B \tan ^3(c+d x) (a+i a \tan (c+d x))^3}{6 d}-\frac {(2 A-3 i B) \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{10 d}-\frac {(12 A-13 i B) \tan ^3(c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{20 d}+\frac {1}{120} \int \tan ^2(c+d x) (a+i a \tan (c+d x)) \left (6 a^3 (68 A-67 i B)+6 a^3 (92 i A+93 B) \tan (c+d x)\right ) \, dx\\ &=-\frac {a^4 (92 A-93 i B) \tan ^3(c+d x)}{60 d}+\frac {i a B \tan ^3(c+d x) (a+i a \tan (c+d x))^3}{6 d}-\frac {(2 A-3 i B) \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{10 d}-\frac {(12 A-13 i B) \tan ^3(c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{20 d}+\frac {1}{120} \int \tan ^2(c+d x) \left (960 a^4 (A-i B)+960 a^4 (i A+B) \tan (c+d x)\right ) \, dx\\ &=\frac {4 a^4 (i A+B) \tan ^2(c+d x)}{d}-\frac {a^4 (92 A-93 i B) \tan ^3(c+d x)}{60 d}+\frac {i a B \tan ^3(c+d x) (a+i a \tan (c+d x))^3}{6 d}-\frac {(2 A-3 i B) \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{10 d}-\frac {(12 A-13 i B) \tan ^3(c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{20 d}+\frac {1}{120} \int \tan (c+d x) \left (-960 a^4 (i A+B)+960 a^4 (A-i B) \tan (c+d x)\right ) \, dx\\ &=-8 a^4 (A-i B) x+\frac {8 a^4 (A-i B) \tan (c+d x)}{d}+\frac {4 a^4 (i A+B) \tan ^2(c+d x)}{d}-\frac {a^4 (92 A-93 i B) \tan ^3(c+d x)}{60 d}+\frac {i a B \tan ^3(c+d x) (a+i a \tan (c+d x))^3}{6 d}-\frac {(2 A-3 i B) \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{10 d}-\frac {(12 A-13 i B) \tan ^3(c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{20 d}-\left (8 a^4 (i A+B)\right ) \int \tan (c+d x) \, dx\\ &=-8 a^4 (A-i B) x+\frac {8 a^4 (i A+B) \log (\cos (c+d x))}{d}+\frac {8 a^4 (A-i B) \tan (c+d x)}{d}+\frac {4 a^4 (i A+B) \tan ^2(c+d x)}{d}-\frac {a^4 (92 A-93 i B) \tan ^3(c+d x)}{60 d}+\frac {i a B \tan ^3(c+d x) (a+i a \tan (c+d x))^3}{6 d}-\frac {(2 A-3 i B) \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{10 d}-\frac {(12 A-13 i B) \tan ^3(c+d x) \left (a^4+i a^4 \tan (c+d x)\right )}{20 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 9.16, size = 951, normalized size = 4.23 \[ \frac {x \left (-4 A \cos ^4(c)+4 i B \cos ^4(c)+20 i A \sin (c) \cos ^3(c)+20 B \sin (c) \cos ^3(c)+40 A \sin ^2(c) \cos ^2(c)-40 i B \sin ^2(c) \cos ^2(c)+4 A \cos ^2(c)-4 i B \cos ^2(c)-40 i A \sin ^3(c) \cos (c)-40 B \sin ^3(c) \cos (c)-12 i A \sin (c) \cos (c)-12 B \sin (c) \cos (c)-20 A \sin ^4(c)+20 i B \sin ^4(c)-12 A \sin ^2(c)+12 i B \sin ^2(c)+4 i A \sin ^4(c) \tan (c)+4 B \sin ^4(c) \tan (c)+4 i A \sin ^2(c) \tan (c)+4 B \sin ^2(c) \tan (c)-i (A-i B) (8 \cos (4 c)-8 i \sin (4 c)) \tan (c)\right ) (i \tan (c+d x) a+a)^4 (A+B \tan (c+d x)) \cos ^5(c+d x)}{(\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}+\frac {(i A \cos (2 c)+B \cos (2 c)+A \sin (2 c)-i B \sin (2 c)) \left (4 \cos (2 c) \log \left (\cos ^2(c+d x)\right )-4 i \log \left (\cos ^2(c+d x)\right ) \sin (2 c)\right ) (i \tan (c+d x) a+a)^4 (A+B \tan (c+d x)) \cos ^5(c+d x)}{d (\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}+\frac {\sec (c) \sec (c+d x) \left (\frac {1}{240} \cos (4 c)-\frac {1}{240} i \sin (4 c)\right ) (420 i A \cos (c)+490 B \cos (c)-600 A d x \cos (c)+600 i B d x \cos (c)+300 i A \cos (c+2 d x)+345 B \cos (c+2 d x)-450 A d x \cos (c+2 d x)+450 i B d x \cos (c+2 d x)+300 i A \cos (3 c+2 d x)+345 B \cos (3 c+2 d x)-450 A d x \cos (3 c+2 d x)+450 i B d x \cos (3 c+2 d x)+90 i A \cos (3 c+4 d x)+120 B \cos (3 c+4 d x)-180 A d x \cos (3 c+4 d x)+180 i B d x \cos (3 c+4 d x)+90 i A \cos (5 c+4 d x)+120 B \cos (5 c+4 d x)-180 A d x \cos (5 c+4 d x)+180 i B d x \cos (5 c+4 d x)-30 A d x \cos (5 c+6 d x)+30 i B d x \cos (5 c+6 d x)-30 A d x \cos (7 c+6 d x)+30 i B d x \cos (7 c+6 d x)-790 A \sin (c)+860 i B \sin (c)+720 A \sin (c+2 d x)-780 i B \sin (c+2 d x)-465 A \sin (3 c+2 d x)+510 i B \sin (3 c+2 d x)+354 A \sin (3 c+4 d x)-366 i B \sin (3 c+4 d x)-120 A \sin (5 c+4 d x)+150 i B \sin (5 c+4 d x)+79 A \sin (5 c+6 d x)-86 i B \sin (5 c+6 d x)) (i \tan (c+d x) a+a)^4 (A+B \tan (c+d x))}{d (\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.48, size = 334, normalized size = 1.48 \[ \frac {{\left (840 i \, A + 1080 \, B\right )} a^{4} e^{\left (10 i \, d x + 10 i \, c\right )} + {\left (3060 i \, A + 3420 \, B\right )} a^{4} e^{\left (8 i \, d x + 8 i \, c\right )} + {\left (4840 i \, A + 5400 \, B\right )} a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (4080 i \, A + 4500 \, B\right )} a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (1776 i \, A + 1944 \, B\right )} a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (316 i \, A + 344 \, B\right )} a^{4} + {\left ({\left (120 i \, A + 120 \, B\right )} a^{4} e^{\left (12 i \, d x + 12 i \, c\right )} + {\left (720 i \, A + 720 \, B\right )} a^{4} e^{\left (10 i \, d x + 10 i \, c\right )} + {\left (1800 i \, A + 1800 \, B\right )} a^{4} e^{\left (8 i \, d x + 8 i \, c\right )} + {\left (2400 i \, A + 2400 \, B\right )} a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (1800 i \, A + 1800 \, B\right )} a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (720 i \, A + 720 \, B\right )} a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (120 i \, A + 120 \, B\right )} a^{4}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )}{15 \, {\left (d e^{\left (12 i \, d x + 12 i \, c\right )} + 6 \, d e^{\left (10 i \, d x + 10 i \, c\right )} + 15 \, d e^{\left (8 i \, d x + 8 i \, c\right )} + 20 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 15 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 6 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 1.32, size = 600, normalized size = 2.67 \[ \frac {120 i \, A a^{4} e^{\left (12 i \, d x + 12 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 120 \, B a^{4} e^{\left (12 i \, d x + 12 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 720 i \, A a^{4} e^{\left (10 i \, d x + 10 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 720 \, B a^{4} e^{\left (10 i \, d x + 10 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 1800 i \, A a^{4} e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 1800 \, B a^{4} e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 2400 i \, A a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 2400 \, B a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 1800 i \, A a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 1800 \, B a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 720 i \, A a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 720 \, B a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 840 i \, A a^{4} e^{\left (10 i \, d x + 10 i \, c\right )} + 1080 \, B a^{4} e^{\left (10 i \, d x + 10 i \, c\right )} + 3060 i \, A a^{4} e^{\left (8 i \, d x + 8 i \, c\right )} + 3420 \, B a^{4} e^{\left (8 i \, d x + 8 i \, c\right )} + 4840 i \, A a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + 5400 \, B a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + 4080 i \, A a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 4500 \, B a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 1776 i \, A a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + 1944 \, B a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + 120 i \, A a^{4} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 120 \, B a^{4} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 316 i \, A a^{4} + 344 \, B a^{4}}{15 \, {\left (d e^{\left (12 i \, d x + 12 i \, c\right )} + 6 \, d e^{\left (10 i \, d x + 10 i \, c\right )} + 15 \, d e^{\left (8 i \, d x + 8 i \, c\right )} + 20 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 15 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 6 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.03, size = 264, normalized size = 1.17 \[ -\frac {4 i a^{4} B \left (\tan ^{5}\left (d x +c \right )\right )}{5 d}+\frac {a^{4} B \left (\tan ^{6}\left (d x +c \right )\right )}{6 d}-\frac {i a^{4} A \left (\tan ^{4}\left (d x +c \right )\right )}{d}+\frac {a^{4} A \left (\tan ^{5}\left (d x +c \right )\right )}{5 d}+\frac {8 i a^{4} B \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}-\frac {7 a^{4} B \left (\tan ^{4}\left (d x +c \right )\right )}{4 d}+\frac {4 i a^{4} A \left (\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {7 a^{4} A \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}-\frac {8 i a^{4} B \tan \left (d x +c \right )}{d}+\frac {4 a^{4} B \left (\tan ^{2}\left (d x +c \right )\right )}{d}+\frac {8 A \,a^{4} \tan \left (d x +c \right )}{d}-\frac {4 i a^{4} A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {4 a^{4} B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}+\frac {8 i a^{4} B \arctan \left (\tan \left (d x +c \right )\right )}{d}-\frac {8 a^{4} A \arctan \left (\tan \left (d x +c \right )\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.66, size = 150, normalized size = 0.67 \[ \frac {10 \, B a^{4} \tan \left (d x + c\right )^{6} + 12 \, {\left (A - 4 i \, B\right )} a^{4} \tan \left (d x + c\right )^{5} + {\left (-60 i \, A - 105 \, B\right )} a^{4} \tan \left (d x + c\right )^{4} - 20 \, {\left (7 \, A - 8 i \, B\right )} a^{4} \tan \left (d x + c\right )^{3} + {\left (240 i \, A + 240 \, B\right )} a^{4} \tan \left (d x + c\right )^{2} - 480 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{4} + 60 \, {\left (-4 i \, A - 4 \, B\right )} a^{4} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 480 \, {\left (A - i \, B\right )} a^{4} \tan \left (d x + c\right )}{60 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.21, size = 308, normalized size = 1.37 \[ \frac {{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (-a^4\,\left (A-B\,1{}\mathrm {i}\right )+\frac {a^4\,\left (B+A\,3{}\mathrm {i}\right )\,1{}\mathrm {i}}{3}+\frac {B\,a^4\,1{}\mathrm {i}}{3}+\frac {a^4\,\left (3\,B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{3}\right )}{d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-A\,a^4-3\,a^4\,\left (A-B\,1{}\mathrm {i}\right )+a^4\,\left (B+A\,3{}\mathrm {i}\right )\,1{}\mathrm {i}+B\,a^4\,1{}\mathrm {i}+a^4\,\left (3\,B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^5\,\left (\frac {B\,a^4\,1{}\mathrm {i}}{5}+\frac {a^4\,\left (3\,B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{5}\right )}{d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (8\,B\,a^4+A\,a^4\,8{}\mathrm {i}\right )}{d}+\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {A\,a^4\,1{}\mathrm {i}}{2}+\frac {a^4\,\left (A-B\,1{}\mathrm {i}\right )\,3{}\mathrm {i}}{2}+\frac {a^4\,\left (B+A\,3{}\mathrm {i}\right )}{2}+\frac {B\,a^4}{2}+\frac {a^4\,\left (3\,B+A\,1{}\mathrm {i}\right )}{2}\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^4\,\left (\frac {a^4\,\left (A-B\,1{}\mathrm {i}\right )\,3{}\mathrm {i}}{4}+\frac {B\,a^4}{4}+\frac {a^4\,\left (3\,B+A\,1{}\mathrm {i}\right )}{4}\right )}{d}+\frac {B\,a^4\,{\mathrm {tan}\left (c+d\,x\right )}^6}{6\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 3.20, size = 359, normalized size = 1.60 \[ \frac {8 i a^{4} \left (A - i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {- 316 i A a^{4} - 344 B a^{4} + \left (- 1776 i A a^{4} e^{2 i c} - 1944 B a^{4} e^{2 i c}\right ) e^{2 i d x} + \left (- 4080 i A a^{4} e^{4 i c} - 4500 B a^{4} e^{4 i c}\right ) e^{4 i d x} + \left (- 4840 i A a^{4} e^{6 i c} - 5400 B a^{4} e^{6 i c}\right ) e^{6 i d x} + \left (- 3060 i A a^{4} e^{8 i c} - 3420 B a^{4} e^{8 i c}\right ) e^{8 i d x} + \left (- 840 i A a^{4} e^{10 i c} - 1080 B a^{4} e^{10 i c}\right ) e^{10 i d x}}{- 15 d e^{12 i c} e^{12 i d x} - 90 d e^{10 i c} e^{10 i d x} - 225 d e^{8 i c} e^{8 i d x} - 300 d e^{6 i c} e^{6 i d x} - 225 d e^{4 i c} e^{4 i d x} - 90 d e^{2 i c} e^{2 i d x} - 15 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________